package com.gulimall.common.vo;

import lombok.Data;

import java.math.BigDecimal;
import java.util.List;
import java.util.Objects;

//上架模型
@Data
public class SkuEsModel {
    private Long skuId;
    private Long spuId;
    private String skuTitle;
    private BigDecimal skuPrice;
    private String skuImg;
    private Long saleCount;
    private boolean hasStock = true; //是否有库存
    private Long hotScore = 0L; //热度评分
    private Long brandId;
    private Long catalogId;
    private String brandName;
    private String brandImg;
    private String catalogName;
    private List<Attr> attrs; //sku对应的所有属性集合


    @Data
    public static class Attr {

        private Long attrId;
        private String attrName;
        private String attrValue;

        public Attr() {
        }

        public Attr(Long attrId, String attrName, String attrValue) {
            this.attrId = attrId;
            this.attrName = attrName;
            this.attrValue = attrValue;
        }

        @Override
        public boolean equals(Object o) {
            if (this == o) return true;
            if (!(o instanceof Attr)) return false;
            Attr attr = (Attr) o;
            return attrId.equals(attr.attrId) &&
                    attrName.equals(attr.attrName);
        }

        @Override
        public int hashCode() {
            return Objects.hash(attrId, attrName);
        }
    }


    public static void main(String[] args) {
        //new SkuEsModel().new Attr();

        new SkuEsModel.Attr();
    }


}
